import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description: 习题
 * User: 王圆豪
 * Date: 2024-09-08
 * Time: 23:14
 */
public class Test {
    //7-3 合并数组
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a1 = new int[10];
        int[] a2 = new int[10];
        int size1 = 0;
        int size2 = 0;
        for (int i = 0; i < 10; i++) {
            int u = sc.nextInt();
            if (u == 0){
                break;
            }
            a1[i] = u;
            size1++;
        }
        for (int i = 0; i < 10; i++) {
            int u = sc.nextInt();
            if (u == 0){
                break;
            }
            a2[i] = u;
            size2++;
        }
        int size = size1 + size2;
        int[] a = Arrays.copyOf(a1, size);
        for (int i = size1; i < size; i++) {
            a[i] = a2[i - size1];
        }
        for (int i = 0; i < a.length - 1; i++) {
            for (int j = 0; j < a.length - 1 - i; j++) {
                if (a[j] > a[j + 1]){
                    int t = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = t;
                }
            }
        }
        for (int i = 0; i < size; i++) {
            System.out.print(a[i] + " ");
        }
    }
    //7-2 教材6-3：有序数组元素的删除
    public static void main2(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        int size = 0;
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int k = sc.nextInt();
        int u = intFind(a, k);
        if (u < 0){
            System.out.print("delete fail.");
        }else {
            for (int i = u; i < n - 1; i++) {
                a[i] = a[i + 1];
            }
        }
        for (int i = 0; i < a.length - 1; i++) {
            System.out.print(a[i] + " ");
        }
    }

    public static int intFind(int[] a, int k){
        for (int i = 0; i < a.length; i++) {
            if (a[i] == k){
                return i;
            }
        }
        return -1;
    }

    //7-1 教材6-2：有序数组（输入）的插入
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n + 1];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int k = sc.nextInt();
        a[n] = k;

        for (int i = 0; i < a.length - 1; i++) {
            for (int j = 0; j < a.length - i - 1; j++) {
                if (a[j] > a[j + 1]){
                    int t = a[j];
                    a[j] = a[j + 1];
                    a[j + 1] = t;
                }
            }
        }
        for (int i = 0; i < a.length - 1; i++) {
            System.out.print(a[i] + " ");
        }
        System.out.print(a[a.length - 1]);
    }
}
